import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store/index";
import MintUI from "mint-ui";
import "mint-ui/lib/style.css";
import './common/less/index.less';
import {isLogin} from './common/js/auth';

Vue.config.productionTip = false;

Vue.use(MintUI);

router.beforeEach((to, from, next) => {
  if (to.meta.title) { // 设置标题
    document.title = to.meta.title
  }
  if(!isLogin() && to.meta.isLogin) {
    router.push({path:'/login', query:{redirect:to.fullPath}})
  } else {
    next();
  }
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");

